/**
 * 
 */
package com.hu.ta.assignment5.beans;

/**
 * @author cage@g.com
 */
public class TransitionMaxCalculation implements IMaxCalculation<Double> {

	private Viterbi<Double> viterbi;
	private String[] sentence;
	private NGrams transitions;
	private String ngramTag;

	public TransitionMaxCalculation(Viterbi<Double> viterbi, String[] sentence,
			NGrams transitions, String ngramTag) {
		this.viterbi = viterbi;
		this.sentence = sentence;
		this.transitions = transitions;
		this.ngramTag = ngramTag;
	}

	@Override
	public Double getValue(String tag, int w) {
		return viterbi.get(sentence[w]).get(tag)
				+ Math.log(transitions.get(new NGram(tag)).getProbability(
						ngramTag));
	}
}
